from app.utils.excel_diff.comparator import ExcelComparator
import os


def compare_excel_files(
    file1: str, file2: str, output_file: str = "diff_report.xlsx"
) -> list:
    """
    比较两个Excel文件的差异
    :param file1: 第一个Excel文件路径
    :param file2: 第二个Excel文件路径
    :param output_file: 输出结果文件路径（默认为diff_report.xlsx）
    :return: 包含差异记录的字典列表
    """
    comparator = ExcelComparator(file1, file2)
    diff_records = comparator.compare()
    # if output_file:
    #     df = pd.DataFrame(diff_records)
    #     df.to_excel(output_file, index=False, engine="openpyxl")
    return diff_records


if __name__ == "__main__":
    print(
        compare_excel_files(
            r"C:\Users\Administrator\Desktop\1.xlsx",
            r"C:\Users\Administrator\Desktop\2.xlsx",
        )
    )
